package cn.wen.yaling.xo.dao;

import cn.wen.yaling.commons.entity.CommentEntity;
import cn.wen.yaling.commons.entity.QuestionsEntity;
import cn.wen.yaling.commons.entity.UserEntity;
import cn.wen.yaling.commons.entity.WebConfigEntity;
import cn.wen.yaling.commons.vo.CommentChildVO;
import cn.wen.yaling.commons.vo.CommentVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 
 * 
 * @author FY
 * @email 932043654@qq.com
 * @date 2022-08-13 02:07:37
 */
@Mapper
@Component
public interface CommentDao extends BaseMapper<CommentEntity> {

    /**
     * 通过文章Id获取全部的楼主信息
     * @param articleId
     * @return
     */
    List<CommentVO> findByArticleIdAdnParentCommentNull(@Param("articleId") Integer articleId);

    /**
     * 获取子评论
     * @param commentId
     * @return
     */
    List<CommentVO> listTreeComment(@Param("commentId") Integer commentId);

    /**
     * 获取比较干净子评论
     * @param commentId
     * @return
     */
    List<CommentChildVO> listTreeChileComment(@Param("commentId") Integer commentId);

    /**
     * 通过文章Id来获取所属用户信息
     * @return
     */
    UserEntity getUserByArticleId(@Param("articleId") Integer articleId);

    /**
     * 获取=关于我页面的父评论列表
     * @return
     */
    List<CommentVO> findAboutCommentAndParentNull();

    /**
     * 获取问答页面的父评论列表
     * @return
     * @param questionId
     */
    List<CommentVO> findQuestionCommentAndParentNull(@Param("questionId") Integer questionId);

    /**
     * 通过问答Id获取User信息
     * @param questionsId
     * @return
     */
    QuestionsEntity getQuestionsByQuestionId(@Param("questionsId") Integer questionsId);

    /**
     * 获取当前激活的系统配置
     * @return
     */
    WebConfigEntity getWebConfigInfo();


    /**
     * 修改评论的状态
     * @param commentIds
     * @param status
     * @return
     */
    boolean updateByIds(@Param("commentIds") List<Integer> commentIds, @Param("status") int status);
}
